package asia.doing.service.front;

import asia.doing.entity.Tool;
import asia.doing.mapper.ToolMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service(value = "frontToolService")
public class ToolService {
    @Resource
    private ToolMapper toolMapper;


    public List<Tool> selectTool(Tool tool){
        return toolMapper.selectAll(tool);
    }


    public PageInfo<Tool> selectPage(Tool tool, int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        //注意:这里获取到的信息是重复的
        List<Tool> list = toolMapper.selectAll(tool);
        System.out.println(list.size());
        PageInfo<Tool> pageInfo = PageInfo.of(list);
//      List<Activity> activityList = pageInfo.getList(); 可以获取所有列表循环做其他事情
        return pageInfo;
    }
}
